import 'package:jyofservice/bean/function_data_entity.dart';
import 'package:jyofservice/generated/json/base/json_filed.dart';

functionDataEntityFromJson(FunctionDataEntity data, Map<String, dynamic> json) {
	if (json['Code'] != null) {
		data.code = json['Code'].toString();
	}
	if (json['Msg'] != null) {
		data.msg = json['Msg'].toString();
	}
	if (json['Data'] != null) {
		data.data = (json['Data'] as List).map((v) => FunctionDataData().fromJson(v)).toList();
	}
	return data;
}

Map<String, dynamic> functionDataEntityToJson(FunctionDataEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['Code'] = entity.code;
	data['Msg'] = entity.msg;
	data['Data'] =  entity.data?.map((v) => v!.toJson())?.toList();
	return data;
}

functionDataDataFromJson(FunctionDataData data, Map<String, dynamic> json) {
	if (json['ID'] != null) {
		data.iD = json['ID'] is String
				? int.tryParse(json['ID'])
				: json['ID'].toInt();
	}
	if (json['Function_name'] != null) {
		data.functionName = json['Function_name'].toString();
	}
	if (json['Icon'] != null) {
		data.icon = json['Icon'].toString();
	}
	if (json['Url'] != null) {
		data.url = json['Url'].toString();
	}
	if (json['IsParent'] != null) {
		data.isParent = json['IsParent'] is String
				? int.tryParse(json['IsParent'])
				: json['IsParent'].toInt();
	}
	if (json['Position'] != null) {
		data.position = json['Position'].toString();
	}
	if (json['Pid'] != null) {
		data.pid = json['Pid'] is String
				? int.tryParse(json['Pid'])
				: json['Pid'].toInt();
	}
	if (json['OrderNo'] != null) {
		data.orderNo = json['OrderNo'] is String
				? int.tryParse(json['OrderNo'])
				: json['OrderNo'].toInt();
	}
	if (json['OpenMark'] != null) {
		data.openMark = json['OpenMark'] is String
				? int.tryParse(json['OpenMark'])
				: json['OpenMark'].toInt();
	}
	if (json['Remarks'] != null) {
		data.remarks = json['Remarks'];
	}
	if (json['Flag'] != null) {
		data.flag = json['Flag'] is String
				? int.tryParse(json['Flag'])
				: json['Flag'].toInt();
	}
	if (json['CreateDate'] != null) {
		data.createDate = json['CreateDate'].toString();
	}
	if (json['CreateUserId'] != null) {
		data.createUserId = json['CreateUserId'];
	}
	if (json['UpdateDate'] != null) {
		data.updateDate = json['UpdateDate'];
	}
	if (json['UpdateUserId'] != null) {
		data.updateUserId = json['UpdateUserId'];
	}
	if (json['GroupNo'] != null) {
		data.groupNo = json['GroupNo'];
	}
	return data;
}

Map<String, dynamic> functionDataDataToJson(FunctionDataData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['ID'] = entity.iD;
	data['Function_name'] = entity.functionName;
	data['Icon'] = entity.icon;
	data['Url'] = entity.url;
	data['IsParent'] = entity.isParent;
	data['Position'] = entity.position;
	data['Pid'] = entity.pid;
	data['OrderNo'] = entity.orderNo;
	data['OpenMark'] = entity.openMark;
	data['Remarks'] = entity.remarks;
	data['Flag'] = entity.flag;
	data['CreateDate'] = entity.createDate;
	data['CreateUserId'] = entity.createUserId;
	data['UpdateDate'] = entity.updateDate;
	data['UpdateUserId'] = entity.updateUserId;
	data['GroupNo'] = entity.groupNo;
	return data;
}